﻿using System;
using SharpKit.JavaScript;

namespace SharpKit.Onx
{
    /// <summary>
    /// This component implements local storage according to HTML5 Web Storage standard, http://dev.w3.org/html5/webstorage/ . This component doesn't emit any signal.
    /// https://www.onx.ms/#apiPage/localStorage
    /// </summary>
    [JsType(Mode = JsMode.Prototype, Export = false)]
    public class LocalStorage : Emitter
    {
        //No way to new this up
        private LocalStorage()
        { }

        #region Properties
        /// <summary>
        /// 
        /// </summary>
        [JsProperty(NativeField=true)]
        public ulong Length { get { return 0; } }
        #endregion

        #region Actions (Methods)
        /// <summary>
        /// 
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        [JsMethod(Name = "key")]
        public JsString Key(ulong index) 
        { return null; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        [JsMethod(Name = "getItem")]
        public object GetItem(JsString key)
        { return null; }
        
        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        /// <param name="data"></param>
        [JsMethod(Name = "setItem")]
        public void SetItem(JsString key, object data)
        { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        [JsMethod(Name = "removeItem")]
        public void RemoveItem(JsString key)
        { }

        ///// <summary>
        ///// 
        ///// </summary>
        //[JsMethod(Name = "clear")]
        //public void Clear()
        //{ }
        #endregion
    }
}